import type { IShapeProps, IType } from './IShape';
import { IColor } from './IStage';

export type Handles = 'tl' | 'tm' | 'tr' | 'mr' | 'br' | 'bm' | 'bl' | 'ml';
export class BaseShape implements IShapeProps {
  x: number;

  y: number;

  w: number;

  h: number;

  show: boolean;

  type: IType;

  disableUserSelect: boolean;

  preventDeactivation: boolean;

  lock: boolean;

  axis: 'both' | 'y' | 'x';

  grid: [number, number];

  id: string;

  z: number;

  minWidth: number;

  minHeight: number;

  active: boolean;

  draggable: boolean;

  lockAspectRatio: boolean;

  resizable: boolean;

  parent: boolean;

  handles: Handles[];

  classNameDraggable: string;

  classNameResizable: string;

  classNameDragging: string;

  classNameActive: string;

  classNameHandle: string;

  classNameResizing: string;

  hasBorder: boolean;

  icon: string;

  borderColor: IColor;

  constructor(type: IType) {
    this.x = 0;
    this.y = 0;
    this.w = 30;
    this.h = 30;
    this.show = true;
    this.disableUserSelect = true;
    this.preventDeactivation = false;
    this.lock = false;
    this.axis = 'both';
    this.grid = [1, 1];
    this.id = '';
    this.z = 0;
    this.minWidth = 1;
    this.minHeight = 1;
    this.active = true;
    this.draggable = true;
    this.lockAspectRatio = false;
    this.resizable = true;
    this.parent = true;
    this.handles = ['tl', 'tm', 'tr', 'mr', 'br', 'bm', 'bl', 'ml'];
    this.classNameDraggable = '';
    this.classNameResizable = '';
    this.classNameDragging = '';
    this.classNameActive = '';
    this.classNameHandle = '';
    this.classNameResizing = '';
    this.hasBorder = false;
    this.type = type;
    this.icon = '';
    this.borderColor = IColor.BLACK;
  }
}
